package pl.elot.xml.parsers;

import net.grzechocinski.android.xml.parser.AbstractParser;
import org.w3c.dom.Element;
import pl.elot.domain.Airport;

import java.util.List;

/**
 * @author mateusz.grzechocinski@gmail.com
 * @since 2010-10-29
 */
public class AirportParser extends AbstractParser<Airport> {

    @Override
    public List<Airport> unmarshallAll(Element root) {
        return super.unmarshallAll(root, "Airports");
    }

    @Override
    protected Airport unmarshall() {
        return new Airport()
                .withCode(getElementValue("code"))
                .withName(getElementValue("airportName"))
                .inCity(getElementValue("city"))
                .inCountry(getElementValue("country"));
    }
}
